package com.hy;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;

public class Triangle {
    private double a;
    private double b;
    private double c;

    public boolean TestTrue(double a, double b, double c) throws Exception {
        if (a + b > c && a + c > b && b + c > a) {
            this.a = a;
            this.b = b;
            this.c = c;
            return true;
        } else {
            throw new Exception("无法构成三角形");
        }

    }

    public double perimeter(double a, double b, double c) {
        return a + b + c;

    }


    public double area(double a, double b, double c) {
        double p = (a + b + c) / 2.0;
        double s = Math.sqrt(p * (p - a) * (p - b) * (p - c));
        return s;

    }

}
